/* pts05EntityEquipment.cpp
 *
 * --
 * Copyright (c) 2012, Christophe Huriaux
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * --
 */

#include <packet/pts05EntityEquipment.h>
#include <wrapper/JavaStreamWrapper.h>

pts05EntityEquipment::pts05EntityEquipment()
    : McPacketToServer(0x05), entityId(0), slot(0), item(0), damage(0)
{
}

pts05EntityEquipment::pts05EntityEquipment(int32_t entityId, int16_t slot, int16_t item, int16_t damage)
    : McPacketToServer(0x05), entityId(entityId), slot(slot), item(item), damage(damage)
{
}

unsigned int pts05EntityEquipment::length()
{
    return 1 + 4 + 2 + 2 + 2;
}

void pts05EntityEquipment::forge(std::ostream& out)
{
    JavaStreamWrapper jsw(out);

    jsw.writeByte(getPacketId());
    jsw.writeInt(entityId);
    jsw.writeShort(slot);
    jsw.writeShort(item);
    jsw.writeShort(damage);

}

int32_t pts05EntityEquipment::getEntityId()
{
    return entityId;
}

int16_t pts05EntityEquipment::getSlot()
{
    return slot;
}

int16_t pts05EntityEquipment::getItem()
{
    return item;
}

int16_t pts05EntityEquipment::getDamage()
{
    return damage;
}


void pts05EntityEquipment::setEntityId(int32_t entityId)
{
    this->entityId = entityId;
}

void pts05EntityEquipment::setSlot(int16_t slot)
{
    this->slot = slot;
}

void pts05EntityEquipment::setItem(int16_t item)
{
    this->item = item;
}

void pts05EntityEquipment::setDamage(int16_t damage)
{
    this->damage = damage;
}


